class CreateComments < ActiveRecord::Migration
  def self.up
    create_table :comments do |t|
      t.text :description, :null => false
      t.references :user, :null => false
      t.references :post, :null => false
      t.references :children
      t.references :father
      
      t.timestamps
    end
    add_index(:comments, [:description, :user_id, :post_id, :children_id], :unique => true, :name => "uk_comment")
  end

  def self.down
    drop_table :comments
  end
end